﻿using System;
using System.Collections.Generic;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.Practices.Modeling.ExtensionProvider.Metadata;
using Microsoft.Practices.Services.ItineraryDsl;
using Microsoft.Practices.Modeling.ExtensionProvider.Extension;
using Microsoft.Practices.Modeling.Common;
using Microsoft.Practices.Modeling.Common.Design;
using Microsoft.Practices.Modeling.Services.Design;
using Microsoft.Practices.Modeling.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace BizTalk.ESB.Extensions.ResolverExtenders
{
    //[Serializable]
    //[ObjectExtender(typeof(Resolver))]
    //public class StaticContextResolverExtender : ObjectExtender<Resolver>
    //{
    //    [Category(StaticContextResolverExtenderProvider.ExtensionProviderPropertyCategory),
    //        Description("Name of promoted property to retrieve the value of."),
    //        DisplayName("Property Name"),
    //        ReadOnly(false),
    //        Browsable(true)]
    //    [XmlElement]
    //    [StringLengthValidator(1, RangeBoundaryType.Inclusive, 0, RangeBoundaryType.Ignore, MessageTemplate = "The 'PropertyName' property should not be null or empty.")]
    //    public String PropertyName { get; set; }

    //    [Category(StaticContextResolverExtenderProvider.ExtensionProviderPropertyCategory),
    //        Description("Namespace of promoted property to retrieve the value of."),
    //        DisplayName("Property Namespace"),
    //        ReadOnly(false),
    //        Browsable(true)]
    //    [XmlElement]
    //    [StringLengthValidator(1, RangeBoundaryType.Inclusive, 0, RangeBoundaryType.Ignore, MessageTemplate = "The 'PropertyNamespace' property should not be null or empty.")]
    //    public String PropertyNamespace { get; set; }

    //    [Category(StaticContextResolverExtenderProvider.ExtensionProviderPropertyCategory),
    //        Description("Value of to use if the specified promoted property does not exist or does not have a value."),
    //        DisplayName("Default Value"),
    //        ReadOnly(false),
    //        Browsable(true)]
    //    [XmlElement]
    //    public String DefaultValue { get; set; }
    //}

    [Serializable]
    [ObjectExtender(typeof(Resolver))]
    public class BreContextResolverExtender : ObjectExtender<Resolver>
    {
        [EditorOutputProperty("Version", "Version", new String[] { }),
            Category("Extender Settings"),
            Description("Specifies the policy"),
            DisplayName("Policy"),
            ReadOnly(false),
            Browsable(true),
            Editor(typeof(BiztalkPolicyEditor), typeof(UITypeEditor)),
            TypeConverter(typeof(TypeConverter))]
        public String Policy { get; set; }

        [ReadOnly(false),
            DisplayName("Version"),
            Category("Extender Settings"),
            Description("Specifies the policy version"),
            Browsable(true)]
        public VersionNumber Version { get; set; }

        [Description("Used to recognize the Document Type.  Note: This is a messaging only scenario and is not suppored for Orchestration. i.e. - in case of orchestration, the field will always be set to 'false'."),
            DisplayName("Recognize Message Format"),
            Browsable(true),
            ReadOnly(false),
            Category("Extender Settings")]
        public Boolean RecognizeMessageFormat { get; set; }

        [Description("Determines if the message will be sent to the policy as a fact."),
            ReadOnly(false),
            Browsable(true),
            Category("Extender Settings"),
            DisplayName("UseMsg")]
        public Boolean UseMsg { get; set; }

        [Description("Determines if the message context will be sent to the policy as a fact."),
            ReadOnly(false),
            Browsable(true),
            Category("Extender Settings"),
            DisplayName("UseMsgContext")]
        public Boolean UseMsgContext { get; set; }
    }
}
